package cn.ac.zing.api.enums;

/**
 * @Author：dcy
 * @name：ProtocolTypeEnum
 * @Date：2024/5/21 20:36
 */
public enum ProtocolTypeEnum {

    /**
     * 升级报文
     */
    UPDATE(1, "update"),
    /**
     * 心跳报文
     */
    HEART(2, "heart");

    private Integer code;

    private String desc;

    ProtocolTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static ProtocolTypeEnum getByCode(int codeVal) {
        for (ProtocolTypeEnum protocolTypeEnum: ProtocolTypeEnum.values()) {
            if (protocolTypeEnum.code == codeVal) {
                return protocolTypeEnum;
            }
        }
        return null;
    }
}
